<?php

/**
 * MVM_MALL 网上商店系统  登 陆
 * ============================================================================
 * 版权所有 (C) 2007-2010 www.mvmmall.com，并保留所有权利。
 * 网站地址: http://www.mvmmall.com
 * ----------------------------------------------------------------------------
 * 这是一个免费开源的软件；这意味着您可以在不用于商业目的的前提下对程序代码
 * 进行修改、使用和再发布。
 * ============================================================================
 * $Author:  www.mvmmall.com  $
 * $Date: 2008-06-28 $
 * $Id: logging.php  www.mvmmall.com$
 * ---------------------------------------------
*/

require_once './include/common.inc.php';
if($action=='logout'){
	session_destroy();
	//会员整合插件
	$result = $db->query("SELECT id,class_name,cfg FROM `{$tablepre}passport`");
	while ($port = $db->fetch_array($result)){
		require_once MVMMALL_ROOT.'include/passport/'. $port['class_name'].'.class.php';
		$rowst = new  $port['class_name'](unserialize($port['cfg']));
		$rowst->post_logout();
	}
	//end
	header('Location: '.dreferer());
}

elseif($action == 'login'){
	$m_check_id && show_msg('login_already',dreferer());
	if($setp==1 && $_POST){
		!$login_id    && show_msg('intput_member');
		!$login_pass  && show_msg('password_require');
		//登陆验证码判断
		if($mm_login_code==1){
			require_once MVMMALL_ROOT.'include/captcha.class.php';
			$Captcha= new  Captcha();
			!$Captcha->CheckCode($code) && show_msg('code_wrong');
		}
		$login_pass = md5(dhtmlchars($login_pass));
		$login_id   = dhtmlchars($login_id);
		require_once MVMMALL_ROOT.'include/passport.inc.php';
	}else {
		require_once MVMMALL_ROOT.'header.php';
		$referer    = dreferer();
		$navigation = make_navigation($lang['user_login'],GetBaseUrl('logging','login'));//导航
		require_once template('login');
		footer();
	}
} else {
    show_msg('pass_worng');
}
